package cz.data.common.mongo.manage;

import cz.data.common.support.db.DbProperty;
import cz.data.common.support.db.DbType;
import cz.data.common.support.db.manage.DbManage;
import cz.data.common.support.db.manage.DbManageFactory;

public class MongoManageFactory implements DbManageFactory {

    @Override
    public DbManage factory(DbProperty property) {
        String mongodbUrl = DbType.MONGODB.getUrl();
        mongodbUrl = mongodbUrl.replace("${host}", property.getHost())
                .replace("${port}", String.valueOf(property.getPort()))
                .replace("${user}", property.getUsername())
                .replace("${pass}", property.getPassword());
//                .replace("${dbName}", property.getDbName());
        return new MongoManage(mongodbUrl, property);
    }
}
